//
//  FriendHeaderView.m
//  ChangChat
//
//  Created by Cocoa on 2019/9/3.
//  Copyright © 2019 yibai. All rights reserved.
//

#import "FriendListHeaderView.h"

@implementation FriendListHeaderView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}
- (void)setupUI {
    
    self.iconImgView = [UIImageView new];
    self.nicknameLabel = [UILabel k_labelWithFontSize:15 textColor:UIColor.k_t2Color];
    self.nicknameLabel.numberOfLines = 0;
    self.actionBtn = UIButton.k_init();
    
//    self.groupImgView = [UIImageView new];
//    self.groupNameLabel = [UILabel k_labelWithFontSize:15 textColor:UIColor.k_t2Color];
//    self.groupActionBtn = UIButton.k_init();
    
    UIImageView *rightArrowImgView = [[UIImageView alloc] initWithImage:UIImage.k_imgName(@"arrow_right")];
//    UIImageView *rightArrowImgView2 = [[UIImageView alloc] initWithImage:UIImage.k_imgName(@"arrow_right")];
    
    [self addSubview:self.iconImgView];
    [self addSubview:self.nicknameLabel];
    [self addSubview:self.actionBtn];
    [self addSubview:rightArrowImgView];
    
//    [self addSubview:self.groupImgView];
//    [self addSubview:self.groupNameLabel];
//    [self addSubview:self.groupActionBtn];
//    [self addSubview:rightArrowImgView2];
    
    [self.iconImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.mas_offset(15);
        make.size.mas_equalTo(CGSizeMake(40, 40));
        make.bottom.mas_offset(-15);
    }];
    
    [self.nicknameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.iconImgView.mas_right).offset(15);
        make.centerY.equalTo(self.iconImgView);
    }];
    
    
    [rightArrowImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_offset(-15);
        make.centerY.equalTo(self.iconImgView);
    }];
    
    [self.actionBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_offset(0);
        make.bottom.equalTo(self.iconImgView.mas_bottom).offset(7);
    }];
    
//    [self.groupImgView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.iconImgView);
//        make.size.equalTo(self.iconImgView);
//        make.top.equalTo(self.iconImgView.mas_bottom).offset(15);
//        make.bottom.mas_offset(-15);
//    }];
//
//    [self.groupNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.nicknameLabel);
//        make.centerY.equalTo(self.groupImgView);
//    }];
//
//    [self.groupActionBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(self.groupImgView).offset(-7);
//        make.right.bottom.left.mas_offset(0);
//    }];
//    [rightArrowImgView2 mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.right.equalTo(rightArrowImgView);
//        make.centerY.equalTo(self.groupImgView);
//    }];
    
    [self mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(ScreenWidth);
    }];
    
    self.iconImgView.image = UIImage.k_imgName(@"friend_add_new");
//    self.groupImgView.image = UIImage.k_imgName(@"friend_group");
//    self.groupNameLabel.text = @"群聊";
    self.nicknameLabel.text = @"新朋友";
    
}


@end
